<!--#Include File="conn.asp" -->
<!--#Include File="include/inc.asp"-->
<%
'====================================================================
'= Team Elite - Elite Article System
'= Copyright (c) 2005 - 2006 Eason Chan All Rights Reserved.
'=-------------------------------------------------------------------
'= 版权协议：
'=	GPL (The GNU GENERAL PUBLIC LICENSE Version 2, June 1991)
'=-------------------------------------------------------------------
'= 文件名称：Article.asp
'= 摘    要：文章显示文件
'=-------------------------------------------------------------------
'= 最后更新：eason007
'= 最后日期：2006-03-28
'====================================================================

Dim ArticleId,ArticleInfo
Dim FirstArticle,NextArticle
Dim PageContent
Dim i,TempStr,TempArray
Dim sHTMLFilePath
Dim MakeHtml
Dim Folder
Dim IsView

MakeHtml=False

ArticleId=EA_Pub.SafeRequest(3,"articleid",0,0,0)

'load article info 25 truetime
ArticleInfo=EA_DBO.Get_Article_Info(ArticleId,1)
If Not IsArray(ArticleInfo) Then Call EA_Pub.ShowErrMsg(9,1)

If Not ArticleInfo(20,0) Or ArticleInfo(21,0) Then Call EA_Pub.ShowErrMsg(9,1)

FirstArticle=EA_DBO.Get_Article_FirstArticle(ArticleInfo(0,0),ArticleInfo(25,0),ArticleId)
NextArticle=EA_DBO.Get_Article_NextArticle(ArticleInfo(0,0),ArticleInfo(25,0),ArticleId)

If EA_Pub.SysInfo(18)="0" Then
	If ArticleInfo(22,0)<=0 And ArticleInfo(23,0)=0 Then
		Folder="Html/"&FormatDateTime(ArticleInfo(13,0),2)
		If Not(EA_Pub.CheckDir(Folder)) Then EA_Pub.MakeNewsDir Folder
	
		sHTMLFilePath=EA_Pub.Cov_ArticlePath(ArticleId,ArticleInfo(13,0),ArticleInfo(25,0),"0")'ok
		
		If ArticleInfo(10,0) Then
			PageContent="<meta http-equiv=""refresh"" content=""0;URL="&ArticleInfo(11,0)&""">"
			
			Call EA_Pub.Save_HtmlFile(sHTMLFilePath,PageContent)
		End If
		
		If Not EA_Pub.Chk_IsExistsHtmlFile(sHTMLFilePath) Then 
			MakeHtml=True
		Else
			Call EA_DBO.Set_Article_ViewNum_UpDate(ArticleId)

			Call EA_Pub.Close_Obj
			Set EA_Pub=Nothing
			
			Response.Redirect sHTMLFilePath
			Response.End 
		End If
	End If
End If

IsView=True

If ArticleInfo(22,0)>0 Or ArticleInfo(23,0)<>0 Then 
	If Not EA_Pub.IsMember Then 
		IsView=False
	Else
		If CDbl(EA_Pub.Mem_GroupSetting(2))>=CDbl(ArticleInfo(22,0)) Then 
			If ArticleInfo(23,0) Then 
				If EA_Pub.Mem_GroupSetting(3)="1" Then 
					IsView=True
				Else
					IsView=False
				End If
			Else
				IsView=True
			End If
		Else
			IsView=False
		End If
	End If
End If

If ArticleInfo(10,0) Then
	If ArticleInfo(22,0)<=0 And ArticleInfo(23,0)=0 Then 
		Call EA_Pub.Close_Obj
		Set EA_Pub=Nothing

		Response.Redirect ArticleInfo(11,0)
		Response.End
	ElseIf Not IsView Then 
		Call EA_Pub.Close_Obj
		Set EA_Pub=Nothing

		Response.Redirect ArticleInfo(11,0)
		Response.End
	End If
End If

PageContent=EA_Temp.Load_Template(ArticleInfo(24,0),"view")

EA_Temp.Title=ArticleInfo(3,0)&"/"&ArticleInfo(2,0)&" - "&EA_Pub.SysInfo(0)
EA_Temp.Nav="<a href="""&SystemFolder&""">"&EA_Pub.SysInfo(0)&"</a>"&EA_Pub.Get_NavByColumnCode(ArticleInfo(1,0))&" >> 正文"

ArticleInfo(5,0)=EA_Pub.Cov_InsideLink(ArticleInfo(5,0),ArticleInfo(0,0))
TempArray=Split(ArticleInfo(14,0),"|")

If Not IsView Then 
	TempStr=ArticleInfo(4,0)
	TempStr=TempStr&"<br><br><b>您当前的权限不允许查看该文章，请先 [<a href='"&SystemFolder&"member/login.asp' rel=""external"">登陆</a>] 或 [<a href='"&SystemFolder&"member/register.asp' rel=""external"">注册</a>]。</b>"
Else
	If TempArray(0)="1" Or TempArray(0)="2" Then 
		TempStr="<div id=""article""></div>"&vbcrlf
		
		TempStr=TempStr&"<xml id=""xmlArticle"">"&vbcrlf
		TempStr=TempStr&"<Article>"&vbcrlf
		TempStr=TempStr&"<Info>"&vbcrlf
		TempStr=TempStr&"<Content>"&vbcrlf
		
		TempStr=TempStr&"<![CDATA["&vbcrlf
		TempStr=TempStr&ArticleInfo(5,0)&vbcrlf
		TempStr=TempStr&"]]>"&vbcrlf
		
		TempStr=TempStr&"</Content>"&vbcrlf
		TempStr=TempStr&"</Info>"&vbcrlf
		TempStr=TempStr&"</Article>"&vbcrlf
		TempStr=TempStr&"</xml>"&vbcrlf
		
		TempStr=TempStr&"<script type=""text/javascript"">"&vbcrlf
		TempStr=TempStr&"//每页显示字数"&vbcrlf
		TempStr=TempStr&"PageSize="&TempArray(1)&";"&vbcrlf
		TempStr=TempStr&"//分页模式"&vbcrlf
		TempStr=TempStr&"flag="&TempArray(0)&";"&vbcrlf
		TempStr=TempStr&"</script>"&vbcrlf
		TempStr=TempStr&"<!--正文分页Js-->"&vbcrlf
		TempStr=TempStr&"<script type=""text/javascript"" src="""&SystemFolder&"js/cutarticle.js""></script>"&vbcrlf
		TempStr=TempStr&"<script type=""text/javascript"">"&vbcrlf
		TempStr=TempStr&"text_pagination(1);"&vbcrlf
		TempStr=TempStr&"</script>"&vbcrlf
	Else
		TempStr="<div id=""article"">"&ArticleInfo(5,0)&"</div>"
	End If
End If

PageContent=Replace(PageContent,"{$ColumnId$}",ArticleInfo(0,0))
PageContent=Replace(PageContent,"{$ArticleId$}",ArticleId)
PageContent=Replace(PageContent,"{$ArticleTitle$}",EA_Pub.Add_ArticleColor(ArticleInfo(17,0),ArticleInfo(3,0)))
PageContent=Replace(PageContent,"{$ArticlePostTime$}",ArticleInfo(13,0))
PageContent=Replace(PageContent,"{$ArticleText$}",TempStr)

PageContent=Replace(PageContent,"{$ArticleAuthor$}","<a href='"&SystemFolder&"florilegium.asp?a_name="&ArticleInfo(8,0)&"&amp;a_id="&ArticleInfo(7,0)&"' rel=""external"">"&ArticleInfo(8,0)&"</a>")
If Len(ArticleInfo(16,0))>0 Then
	PageContent=Replace(PageContent,"{$ArticleFrom$}","<a href='"&ArticleInfo(16,0)&"' rel=""external"">"&ArticleInfo(15,0)&"</a>")
Else
	PageContent=Replace(PageContent,"{$ArticleFrom$}","本站")
End If
If IsArray(FirstArticle) Then
	PageContent=Replace(PageContent,"{$FirstArticle$}","<a href='"&EA_Pub.Cov_ArticlePath(FirstArticle(0,0),FirstArticle(3,0),FirstArticle(4,0),EA_Pub.SysInfo(18))&"' rel=""external"">"&EA_Pub.Add_ArticleColor(FirstArticle(2,0),FirstArticle(1,0))&"</a>")'ok
Else
	PageContent=Replace(PageContent,"{$FirstArticle$}","<span style=""color: #800000;"">已到尽头</span>")
End If
If IsArray(NextArticle) Then
	PageContent=Replace(PageContent,"{$NextArticle$}","<a href='"&EA_Pub.Cov_ArticlePath(NextArticle(0,0),NextArticle(3,0),NextArticle(4,0),EA_Pub.SysInfo(18))&"' rel=""external"">"&EA_Pub.Add_ArticleColor(NextArticle(2,0),NextArticle(1,0))&"</a>")'ok
Else
	PageContent=Replace(PageContent,"{$NextArticle$}","<span style=""color: #800000;"">已到尽头</span>")
End If
PageContent=Replace(PageContent,"{$ArticleViewTotal$}","<script type=""text/javascript"" src="""&SystemFolder&"articleinfo.asp?action=viewtotal&amp;articleid="&ArticleId&"""></script>")
PageContent=Replace(PageContent,"{$ArticleCommentTotal$}","<script type=""text/javascript"" src="""&SystemFolder&"articleinfo.asp?action=commenttotal&amp;articleid="&ArticleId&"""></script>")

EA_Pub.SysInfo(16)=EA_Pub.SysInfo(16)&","&ArticleInfo(12,0)
EA_Pub.SysInfo(17)=ArticleInfo(4,0)

Call CorrList(ArticleInfo(12,0),ArticleInfo(0,0))

PageContent=EA_Temp.Replace_PublicTag(PageContent)

If MakeHtml Then
	Call EA_Pub.Save_HtmlFile(sHTMLFilePath,PageContent)
	
	Call EA_Pub.Close_Obj
	Set EA_Pub=Nothing

	Response.Redirect sHTMLFilePath
	Response.End 
Else
	Response.Write PageContent
End If

Call EA_Pub.Close_Obj
Set EA_Pub=Nothing

Sub CorrList(Keyword,ColumnId)
	Dim ConfigParameterArray

	ConfigParameterArray=EA_Temp.Find_TemplateTagValues("CorrList",PageContent)

	If IsArray(ConfigParameterArray) Then 
		If UBound(ConfigParameterArray) < 8 Then 
			ReDim Preserve ConfigParameterArray(8)
			ConfigParameterArray(8) = "5"
		End If

		If Keyword <> "" Then
			Dim TempArray,i,TempStr,SearchKeyWord
			
			TempArray=Split(Keyword,",")

			For i=0 To UBound(TempArray)
				Select Case iDataBaseType
				Case 0
					SearchKeyWord=SearchKeyWord&"InStr(','+keyword+',',',"&TempArray(i)&",')>0 or "
				Case 1
					SearchKeyWord=SearchKeyWord&" CharIndex(',"&TempArray(i)&",',','+keyword+',')>0 or "
				End Select
			Next

			TempArray=EA_DBO.Get_Article_CorrList(SearchKeyWord,ArticleId,ColumnId,CInt(ConfigParameterArray(8)))
		End If

		TempStr=EA_Temp.Text_List(TempArray,CInt(ConfigParameterArray(0)),CInt(ConfigParameterArray(1)),CInt(ConfigParameterArray(2)),CInt(ConfigParameterArray(3)),CInt(ConfigParameterArray(4)),CInt(ConfigParameterArray(5)),CInt(ConfigParameterArray(6)),CInt(ConfigParameterArray(7)),CInt(ConfigParameterArray(8)))

		Call EA_Temp.Find_TemplateTagByInput("CorrList",TempStr,PageContent)
	End If 
End Sub
%>
